Debugging RTDLLs

You can debug an application that uses RTDLLs. An RTDLL is a Real-Time Dynamic Linked Library. It is similar to a Windows DLL, so it can be debugged within the Visual Studio instance that is debugging your application.

Running an RTSS Application that uses RTDLLs in the Debugger

RTX64 provides a Visual Studio integrated base debugger and launch provider that is used by Visual Studio when debugging Real-time applications . RTSS applications are started by the RTX64 loader instead of the Windows loader. For this reason, when debugging RTSS applications in Visual Studio, conditional breakpoints and the following options in the Debug pull-down menu (which would assume Windows control) are not supported:

NOTE: The RTX64 Debugger supports relative pathnames.

Build Configurations

Four configurations for creating DLLs are generated in Visual Studio when you create a project using the RTX64 RTDLL template:

x64

  • RTSSDebug – Real-time DLL that has debug flags enabled
  • RTSSRelease – Optimized Real-time DLL that does not include additional debug information
  • Debug – Windows 64-bit DLL linked to RTX64 that has debug flags enabled
  • Release – Windows 64-bit DLL linked to RTX64

NOTE: We recommend that you select the RTSSDebug configuration of the application you want to debug, as this configuration is set up to generate debug information.

Set Debugging Properties

Optionally, you can set debugging properties for the application you want to debug. You can:

See Setting Debugging Properties in Visual Studio for more information.

Debugging

To debug an RTDLL, you must now have a solution with two projects: a project that will create an RTDLL and a project that will create an RTSS process that will use the RTDLL. The program that will use the DLL should start when debugging begins.

NOTE: Data breakpoints are not supported.

To debug a program and RTDLL:

  1. To start debugging, select Start Debugging from the Debug pull-down menu, or press the F5 key.

  1. If you get a message asking if you would like to rebuild the SampleRTDLL click No. A rebuild is not necessary since there were no changes since the previous build.
  2. At the first breakpoint, click Modules at the bottom of the window. If symbols are not loaded for either of the modules, right-click and select Load Symbols from the pull-down menu.

NOTE: If Modules is not available from the status bar at the bottom of the window, select Modules from the Windows option in the Debug pull-down menu to open the modules window.

  1. If necessary, locate the symbol file in the RTSS directory where the binaries were built.

The Output window should now indicate that symbols are loaded.

  1. To continue from the first breakpoint, select Continue from the Debug pull-down menu or press the F5 key.
  2. When the debugger stops at the second breakpoint, if this is the call to the toggle function, select Step Into or press the F11 key to step into the DLL function.

Focus will now turn to the SampleRTDLL.c source code.

  1. To continue, select Step Out from the Debug pull-down menu or press Shift+F11.

When focus returns to the SampleRTDLL.c program, you can select to Continue or to Stop Debugging from the Debug pull-down menu.  If you select Continue, program execution will continue until it completes or reaches another breakpoint. If you select Stop, program execution will halt.

 

For a more comprehensive example of debugging a RTDLL, see MiniTutorial: Debugging Applications in Visual Studio.

Related Topics:

MiniTutorials: